package com.haoniu.module.service.impl;

import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.haoniu.module.mapper.RedPacketLogMapper;
import com.haoniu.module.domain.database.RedPacketLog;
import com.haoniu.module.service.RedPacketLogService;
import com.haoniu.common.support.Convert;

/**
 * 红包流水记录 服务层实现
 * 
 * @author houyijun
 * @date 2019-02-18
 */
@Service
public class RedPacketLogServiceImpl implements RedPacketLogService
{
	@Autowired
	private RedPacketLogMapper redPacketLogMapper;

	/**
     * 查询红包流水记录信息
     * 
     * @param id 红包流水记录ID
     * @return 红包流水记录信息
     */
    @Override
	public RedPacketLog selectRedPacketLogById(Integer id) {
	    return redPacketLogMapper.selectRedPacketLogById(id);
	}
	
	/**
     * 查询红包流水记录列表
     * 
     * @param redPacketLog 红包流水记录信息
     * @return 红包流水记录集合
     */
	@Override
	public List<RedPacketLog> selectRedPacketLogList(RedPacketLog redPacketLog) {
	    return redPacketLogMapper.selectRedPacketLogList(redPacketLog);
	}
	
    /**
     * 新增红包流水记录
     * 
     * @param redPacketLog 红包流水记录信息
     * @return 结果
     */
	@Override
	public int insertRedPacketLog(RedPacketLog redPacketLog) {
	    return redPacketLogMapper.insertRedPacketLog(redPacketLog);
	}
	
	/**
     * 修改红包流水记录
     * 
     * @param redPacketLog 红包流水记录信息
     * @return 结果
     */
	@Override
	public int updateRedPacketLog(RedPacketLog redPacketLog) {
	    return redPacketLogMapper.updateRedPacketLog(redPacketLog);
	}

	/**
     * 删除红包流水记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteRedPacketLogByIds(String ids) {
		return redPacketLogMapper.deleteRedPacketLogByIds(Convert.toStrArray(ids));
	}

	@Override
	public BigDecimal countRedMoneyByType(Integer type, Integer userId) {
		return redPacketLogMapper.countRedMoneyByType(type,userId);
	}
}
